package cn.edu.just.firstjavaapp.l20;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


public class ButtonClickHandlerDemo03 {

    static JTextField textField = new JTextField();
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setLayout(new FlowLayout());
        frame.setBounds(100,100,400,300);

        textField.setColumns(20);
        JButton button = new JButton("提交");

        button.addActionListener(e -> {
            System.out.println("我被点了" + textField.getText());
        });
        frame.add(textField);
        frame.add(button);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.setVisible(true);

    }



}


